//
// Created by tang on 2022/3/30.
//

#ifndef ADVANCEALARMSYSTEM_GPIO_HPP
#define ADVANCEALARMSYSTEM_GPIO_HPP

#include <cstdint>

enum PinMode {
    PM_OUTPUT     = 0x00,
    PM_INPUT      = 0x01,
    PM_PULL_NONE  = 0x00,
    PM_PULL_UP    = 0x10,
    PM_PULL_DOWN  = 0x20,
};

class Pin{
    const uint8_t pin_;
    const uint8_t mode_;
public:
    Pin(uint8_t number, uint8_t mode);
    ~Pin();

    [[nodiscard]] bool toggle() const;

    void set(bool high) const;
};

class Pulse {
    const uint8_t pin_;
public:
    Pulse(uint8_t pin, uint32_t frequency, double def_duty);
    ~Pulse();

    int Frequency() const;
    int SetFrequency(uint32_t frequency) const;

    double Duty() const;
    double SetDuty(double duty) const;
};


#endif //ADVANCEALARMSYSTEM_GPIO_HPP
